﻿using Autofac;
using IceCS.Autofac.Core;
using System;

namespace IceCS.Autofac.Cmd
{
    class Program
    {
        static void Main(string[] args)
        {
            OC.Configure();
            // The WriteDate method is where we'll make use
            // of our dependency injection. We'll define that
            // in a bit.
            WriteDate();
        }

        public static void WriteDate()
        {
            // Create the scope, resolve your IDateWriter,
            // use it, then dispose of the scope.
            using (var scope = OC.Container.BeginLifetimeScope())
            {
                var writer = scope.Resolve<IDateWriter>();
                writer.WriteDate();
            }
        }
    }
}
